<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/1/13
  Time: 17:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>易买网 - 首页</title>
    <script type="text/javascript"></script>
        <script src="js/jquery-3.3.1.min.js"></script>
    <link type="text/css" rel="stylesheet" href="css/style.css" />
    <script type="text/javascript" src="scripts/function.js"></script>
    <script>
        function ready() {
            $.ajax({
                type:"POST",
                url:"newsVisitServlet",
                success:function (data) {
                    console.log(data);
                    var html="";
                    for(var i=0;i<data.length;i++){
                        html +="<tr>"+"<td style=\"display:none\">"+data[i].enId+"</td>"+"<td>"+"<a href='newsSearchVisit?enId="+data[i].enId+"'>"+data[i].enTitle+"</td>"
                            +"</tr>"
                    }
                    $("#cosa").html(html);
                    $("#cosas").html(html);
                }
            })
        }
        function getNews(x) {
            $.ajax({
                type:"POST",
                url:"newsVisitServlet",
                datatype:"json",
                data:{
                    "id":$(x).text()
                },
                success:function (data) {
                    console.log(data);
                    var html="";
                    for(var i=0;i<data.length;i++){
                        html +="<tr>"+"<td style=\"display:none\">"+data[i].enId+"</td>"+"<td>"+"<a href='newsSearchVisit?enId="+data[i].enId+"'>"+data[i].enTitle+"</td>"
                            +"</tr>"
                    }
                    $("#cosa").html(html);
                    $("#cosas").html(html);
                }
            })
        }
    </script>
</head>
<body onload="ready();">
<div id="header" class="wrap">
    <div id="logo"><img src="images/logo.gif" /></div>
    <div class="help"><a href="#" class="shopping">购物车</a><a href="login.html">登录</a><a href="register.html">注册</a><a href="guestbook.html">留言</a></div>
    <div class="navbar">
        <ul class="clearfix">
            <li class="current"><a href="index.jsp">首页</a></li>
            <li><a href="#">图书</a></li>
            <li><a href="#">百货</a></li>
            <li><a href="#">品牌</a></li>
            <li><a href="#">促销</a></li>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="wrap">
        <ul class="clearfix">
            <li class="first"><a href="#">音乐</a></li>
            <li><a href="#">影视</a></li>
            <li><a href="#">少儿</a></li>
            <li><a href="#">动漫</a></li>
            <li><a href="#">小说</a></li>
            <li><a href="#">外语</a></li>
            <li><a href="#">数码相机</a></li>
            <li><a href="#">笔记本</a></li>
            <li><a href="#">羽绒服</a></li>
            <li><a href="#">秋冬靴</a></li>
            <li><a href="#">运动鞋</a></li>
            <li><a href="#">美容护肤</a></li>
            <li><a href="#">家纺用品</a></li>
            <li><a href="#">婴幼奶粉</a></li>
            <li><a href="#">饰品</a></li>
            <li class="last"><a href="#">Investor Relations</a></li>
        </ul>
    </div>
</div>
<div id="position" class="wrap">
    您现在的位置：<a href="index.html">易买网</a> &gt; 阅读新闻
</div>
<div id="main" class="wrap">
    <div class="left-side">
        <div class="news-list">
            <h4>最新公告</h4>
            <table id="cosa" style="font-size: 10px">
            </table>
            <table style="font-size: 10px"><tr><td colspan="2">
                <a href="#" onclick="getNews(this)">上一页</a>
                <a href="#" onclick="getNews(this)">下一页</a>
            </td></tr></table>

        </div>
        <div class="spacer"></div>
        <div class="news-list">
            <h4>新闻动态</h4>
            <table id="cosas" style="font-size: 10px">
            </table>
            <table style="font-size: 10px"><tr><td colspan="2">
                <a href="#" onclick="getNews(this)">上一页</a>
                <a href="#" onclick="getNews(this)">下一页</a>
            </td></tr></table>
        </div>
    </div>
    <div id="news" class="right-main">
        <h1>${newsList.enTitle}</h1>
        <div class="content">
            ${newsList.enContent}
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2010 All Rights Reserved. 京ICP证1000001号
</div>

</body>
</html>
